package com.attendance.www.hr.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.attendance.www.hr.beans.AttachmentBean;
import com.attendance.www.hr.dao.mapper.AttachmentMapper;
import com.attendance.www.hr.entitys.Attachment;
import com.attendance.www.hr.service.IAttachmentService;

@Service
public class AttachmentServiceImpl implements IAttachmentService {

	@Resource
	private AttachmentMapper attachmentDao;
	
	
	@Override
	public AttachmentBean addAttachment(String url, String fileName) {
		Attachment attachment = new Attachment();
		attachment.setFileName(fileName);
		attachment.setUrl(url);
		attachmentDao.insertSelective(attachment);
		AttachmentBean attachmentBean = new AttachmentBean();
		attachmentBean.setAttachmentId(attachment.getId());
		attachmentBean.setFileName(attachment.getFileName());
		attachmentBean.setUrl(attachment.getUrl());
		return attachmentBean;
	}

}
